UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XwtkET5eUFsHf+hXwrBtyHLnKX0zQketNaZj+58Zzzg=' 
WHERE 
  key_id = '8c7547c04a28194487859ec4b315ed4233cf38afc5d0216959042499aa54b858' 
  AND (
    token = 'XwtkET5eUFsHf+hXwrBtyHLnKX0zQketNaZj+58Zzzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037