UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n7QRhTabYS34xK5daWfPrOmZPQ88gotZhfGgSPQTMvo=' 
WHERE 
  key_id = '91322760659a999ca330ef0e3d05abf336de6f345e3fc3e74e3767682c6b2d2d' 
  AND (
    token = 'n7QRhTabYS34xK5daWfPrOmZPQ88gotZhfGgSPQTMvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034