UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IHPfOa70yOziEY7OgP0qBu4twc2qG1cNTwbv/e8Fgqw=' 
WHERE 
  key_id = 'ff8fab72a5d987204ac08229385a08d6020a5c3d24cf2e2219f7d7b57f65a999' 
  AND (
    token = 'IHPfOa70yOziEY7OgP0qBu4twc2qG1cNTwbv/e8Fgqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023