UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IrpQisb13hJ0GCeEgZm9FSyRAnAKc/l5W5SnQU8gBnc=' 
WHERE 
  key_id = 'dd095eec6c89d1719ce04270bd7387918b660f13dde928de13b947cfcd3dbcc9' 
  AND (
    token = 'IrpQisb13hJ0GCeEgZm9FSyRAnAKc/l5W5SnQU8gBnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029