UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5gVqebPdNDwXjv/4kOTQpfmO730A0WeJY4tvJkKwkH8=' 
WHERE 
  key_id = '0a7703afcabe3632bf4b4bd8c162d1657450b3cfce19390629d28b183389bb59' 
  AND (
    token = '5gVqebPdNDwXjv/4kOTQpfmO730A0WeJY4tvJkKwkH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026