UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3r044LnzrmkUI+4qli139d8+trOOXo/WeIC9sWa/9fU=' 
WHERE 
  key_id = '5e04b01667f9769fffc5dba02ec52548b6edc836daf693d95e937e151b0884be' 
  AND (
    token = '3r044LnzrmkUI+4qli139d8+trOOXo/WeIC9sWa/9fU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029