UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bd056ncVfGbaAvimbcBMADlPmwGOdI92McLbyOrxdGw=' 
WHERE 
  key_id = 'f970084c9619861c4ffe6907de996f87220e27b8ae69ec41ca4dbf1df050bc9d' 
  AND (
    token = 'Bd056ncVfGbaAvimbcBMADlPmwGOdI92McLbyOrxdGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082