UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '52ineipzj8fuuLWb7iuAvs8aCr18AdADxvz+S4HOdlI=' 
WHERE 
  key_id = '6d6e9df13e5ce87ccdc8d6b82635a4af03955e323c4d3a0f7d47724d3ebcb253' 
  AND (
    token = '52ineipzj8fuuLWb7iuAvs8aCr18AdADxvz+S4HOdlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026