UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mq5fSKhgui7PMC6mmNpm0gD0c2kQTPG0ti/6o4dbC7A=' 
WHERE 
  key_id = '6ac408a5cd8d5bef39eead96466d420e26cd3319aced12b9d390e387ab8ad743' 
  AND (
    token = 'mq5fSKhgui7PMC6mmNpm0gD0c2kQTPG0ti/6o4dbC7A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051