UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5aUgkS9G7XC2NQabRecgQbHN3ob4K6L4hNKUwCUqgJ8=' 
WHERE 
  key_id = 'ac25c74c825ffb3ee655e388ed199108ebb0e36c50e8592363dd5d3ec95abed5' 
  AND (
    token = '5aUgkS9G7XC2NQabRecgQbHN3ob4K6L4hNKUwCUqgJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026