UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o36nnbQr6kRwfxoiLnS3Nt6CXruM5SORx8LC9UKV/Dc=' 
WHERE 
  key_id = '3a4894f87a369f2ef3e45203029342bf236ad34f81eebdf2acad6da3793143c0' 
  AND (
    token = 'o36nnbQr6kRwfxoiLnS3Nt6CXruM5SORx8LC9UKV/Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026