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

Query time 0.00055