UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lgHVjfK7MtvwKRyhXTjjENm+ikR/EziYU8blA+NZCFk=' 
WHERE 
  key_id = '66099561d441fc7ab0e0971b8e3b0fe7a30bfd88e372788947412beb722fa8b4' 
  AND (
    token = 'lgHVjfK7MtvwKRyhXTjjENm+ikR/EziYU8blA+NZCFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022