UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UKHpOkavDiA8PP4K8swHZfmNysg9+k0U2vhAiN4Z8Mw=' 
WHERE 
  key_id = 'dfe283591e7d825ef4d48f5563f813105cd481f3022e519d4b74d4753331a92a' 
  AND (
    token = 'UKHpOkavDiA8PP4K8swHZfmNysg9+k0U2vhAiN4Z8Mw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024