UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yD6wdVat0DBDm7Eg9rvWDnJzUZbHBQAtfSXd+fmSjHY=' 
WHERE 
  key_id = '0ccea59e2b065edd9f5ad0f917c0ece2255a105858abea509d37012b42fee9fb' 
  AND (
    token = 'yD6wdVat0DBDm7Eg9rvWDnJzUZbHBQAtfSXd+fmSjHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016