UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3udu2JHuVGn1zKX7zqW+YB8k7pzald0eKXJrTN/13Rk=' 
WHERE 
  key_id = '4608333844aca72180a560bb56d5bf92c4a7b6781ccb83d3cd230814fcc5821d' 
  AND (
    token = '3udu2JHuVGn1zKX7zqW+YB8k7pzald0eKXJrTN/13Rk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023