UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZ4KxZET5HyKCu/qSii6MYRVpDQxQ/IP5ZLfEQJuHQ4=' 
WHERE 
  key_id = 'd32bce4746fd927aa0c27e717cd739dc64be94c3c08a48369fb04d673596d673' 
  AND (
    token = 'TZ4KxZET5HyKCu/qSii6MYRVpDQxQ/IP5ZLfEQJuHQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042