UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fcieykqlogWpgp0jp3CFULLJL2KW98GTGTYDzVx6hAY=' 
WHERE 
  key_id = '3bccf5e7516a2e2a7bd5e7c965619d788cdafdca3aa3474b8c033f7b2d138681' 
  AND (
    token = 'fcieykqlogWpgp0jp3CFULLJL2KW98GTGTYDzVx6hAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044