UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 've6YC+W3Yl8OJ0Cr1pZS9MYBdhxNc9og7ajPKPOSf9w=' 
WHERE 
  key_id = '7163c3f05be68c77db7cc47df9ac5d5e7133e6b3fee1c7a7dd691e661cdb54b1' 
  AND (
    token = 've6YC+W3Yl8OJ0Cr1pZS9MYBdhxNc9og7ajPKPOSf9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020