UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'noJSeYTFiEprLs8xq0Qz0JgxDklc+y8hZvGel6Z24ec=' 
WHERE 
  key_id = '785c874e1a37b4e4ab7de7d47ca71820f2f2f2926141c5fa2d1b77d4c35328bb' 
  AND (
    token = 'noJSeYTFiEprLs8xq0Qz0JgxDklc+y8hZvGel6Z24ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031