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

Query time 0.00051