UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kg2Sphrg8rQuTiFPbn02yZY4eJ+vzVIghlzprF8osGA=' 
WHERE 
  key_id = '3f585de6c6fa7ab551856a4d21f7efd161727d150c42c6eed8a9cc4bf1230471' 
  AND (
    token = 'Kg2Sphrg8rQuTiFPbn02yZY4eJ+vzVIghlzprF8osGA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029