UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aNrlGWrlWCoKM3y03EVUXIyxPFcKawnx5NLIIV8fNnY=' 
WHERE 
  key_id = '5063aa33e8926bcb7921bf52616d14a290678c9cf494634d4bc0d8852ccbce1c' 
  AND (
    token = 'aNrlGWrlWCoKM3y03EVUXIyxPFcKawnx5NLIIV8fNnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040