UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KyXK1gicopeE26xFF7rZ8RxwUte6tITAVo/YlVC0jYE=' 
WHERE 
  key_id = '97f73d66551ef4abfb1d105c5eddbf17bc8a95425516753da62eed50848be444' 
  AND (
    token = 'KyXK1gicopeE26xFF7rZ8RxwUte6tITAVo/YlVC0jYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026