UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gu+5UU++uUEX5B8JWAesaxo5fjAl3mnPVRah0DdfUfQ=' 
WHERE 
  key_id = '3532761825fd76267791d2db30802056f8ba3f5ee9828fa621a87a246d85d09f' 
  AND (
    token = 'Gu+5UU++uUEX5B8JWAesaxo5fjAl3mnPVRah0DdfUfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052