UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '49AIHqos2RqgMQs1WUScFtDwXet/5sjYlEm3VGV23cc=' 
WHERE 
  key_id = 'c229a058429ac3c040c3836b3d47291987d5be0064a58279059941c09a43e916' 
  AND (
    token = '49AIHqos2RqgMQs1WUScFtDwXet/5sjYlEm3VGV23cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047