UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J78JBm4e4Lo53heR8GUKsai2Al91eD44Qj10ZU54om4=' 
WHERE 
  key_id = '9e2697e0299a038ce19414520e395191c52ab5816f0bd1bb26aebd2dded88492' 
  AND (
    token = 'J78JBm4e4Lo53heR8GUKsai2Al91eD44Qj10ZU54om4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031