UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'djTuERwmMO4nqbKaBTWoz+OcUZBYa+drcnOKng5ip3M=' 
WHERE 
  key_id = 'ee0e18875e61c8ca37084ae728105b25dffb36c5d8075f91b16359754431bc7a' 
  AND (
    token = 'djTuERwmMO4nqbKaBTWoz+OcUZBYa+drcnOKng5ip3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037