UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7re1EDU0YpE3DwpKQzI61Ff7t1bPzT1RULPeBGl9duU=' 
WHERE 
  key_id = '3221521cfc144d7db1459805c1d241cda597de1848d32a125819671a11b543b5' 
  AND (
    token = '7re1EDU0YpE3DwpKQzI61Ff7t1bPzT1RULPeBGl9duU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036