UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uLO0YPNGV3I2h8oUslJnpZurnHW3faWR/CD57rzSkb8=' 
WHERE 
  key_id = '9e3d82066be1faf949375b40e7b0b7f52781223c493bf2631ec907bcddeb0351' 
  AND (
    token = 'uLO0YPNGV3I2h8oUslJnpZurnHW3faWR/CD57rzSkb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025