UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBDKuGufIg6cm3Q0f7vxc2WsBo1MuXmGuvCQYEXBgnY=' 
WHERE 
  key_id = 'd078e7f725422f78c85d7550885de6cb458460535345e35a836208354edaa0c9' 
  AND (
    token = 'VBDKuGufIg6cm3Q0f7vxc2WsBo1MuXmGuvCQYEXBgnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028