UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2vtvKINZcRjBfJlLW55cA9wgGP5oVhOUG8TCCBRmMpM=' 
WHERE 
  key_id = '0b306df3693eaa047e0799d68effa473ae9139f07e8b62bff732db380a742992' 
  AND (
    token = '2vtvKINZcRjBfJlLW55cA9wgGP5oVhOUG8TCCBRmMpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040