UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EPAiaCeF46P7mqO69aRjFmDi838A71LZj1YvUFQOlGo=' 
WHERE 
  key_id = '040c06ca288d4d61334aad3823ed39c06d3675094cdcb96afd0800ec7dfe896e' 
  AND (
    token = 'EPAiaCeF46P7mqO69aRjFmDi838A71LZj1YvUFQOlGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025