UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KJ+rgX8RggSCPxO0nEbUPk7+Paa3mm7Jx4B7e8SOZ6E=' 
WHERE 
  key_id = '9a9264a30e91b64f87d699a3a9690d314adf5fedb6c1658902d6edc8016ccb1f' 
  AND (
    token = 'KJ+rgX8RggSCPxO0nEbUPk7+Paa3mm7Jx4B7e8SOZ6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036