UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zhzvE7Wx7JU4m2GWIOAtYfuVCZBw4vNTjOashMfSCsE=' 
WHERE 
  key_id = '8e57f8302400e94aaad2831a1136c536592ce73beca6485fdef12f973d63ad1a' 
  AND (
    token = 'zhzvE7Wx7JU4m2GWIOAtYfuVCZBw4vNTjOashMfSCsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044