UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ateeeTFtd++496wD9fautdSvS2Ii+2rsQI446taWgv0=' 
WHERE 
  key_id = '691d231e097438b4b05af3e25b92aa3e4a7171d2d3771fde62f14ff889847a61' 
  AND (
    token = 'ateeeTFtd++496wD9fautdSvS2Ii+2rsQI446taWgv0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036