UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GDmZbhpTdLCh8jzlAmNncsR2OZ6Yaio04/Fn8E7LZJU=' 
WHERE 
  key_id = 'd87b38a37b07a858aba1262d2bcefe1b83418148a4f482191a07a5fd4f949e8e' 
  AND (
    token = 'GDmZbhpTdLCh8jzlAmNncsR2OZ6Yaio04/Fn8E7LZJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032