UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oWXsF5SjMT1yGsivHygqwDplB/tj9qN7Uc8+Ldoq2bk=' 
WHERE 
  key_id = '112b0012866c11a80ad11732de0d207e6cbd83cb22f22bcca92651414a039f18' 
  AND (
    token = 'oWXsF5SjMT1yGsivHygqwDplB/tj9qN7Uc8+Ldoq2bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032