UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r7QiVt0+fxJkJV8ucBXC9603AUkhSIoxQ56THndh3BQ=' 
WHERE 
  key_id = '2826a56451dab2296690887dafe0250073df74dc0b358db282cbf9cd7e65d199' 
  AND (
    token = 'r7QiVt0+fxJkJV8ucBXC9603AUkhSIoxQ56THndh3BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074