UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+11MASyv/XKoPBAmMnRujRpf3zfK+syrgTJcx418yQ=' 
WHERE 
  key_id = '3b4813dc98f4b8a93f014eed181e743203cdaf03d36bfd82420bf20632d23536' 
  AND (
    token = 'P+11MASyv/XKoPBAmMnRujRpf3zfK+syrgTJcx418yQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022