UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tq5a8HDJX8MD/KeZQYQt2uAxT2Bjw6FrHHroEfPHFv4=' 
WHERE 
  key_id = '24e7fa78d839b7f387f5966ac3ef0d54df251bc1200de127938fcfa5a9618e50' 
  AND (
    token = 'Tq5a8HDJX8MD/KeZQYQt2uAxT2Bjw6FrHHroEfPHFv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029