UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3VSNo0zhoze47ZqsAP/apjH4sMh74dUWSSElKKiYNmE=' 
WHERE 
  key_id = '40e16fae517d3f09e7aaecda3e71677449bc85838832e77a044d285fd3475451' 
  AND (
    token = '3VSNo0zhoze47ZqsAP/apjH4sMh74dUWSSElKKiYNmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046