UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TwTpp25rklST/xveORXnSJpic0/Xtcty68ABJZuaIfU=' 
WHERE 
  key_id = '043b07f2b6e854e86693342e9dec32449185b4675d826c499d880aba8c4b95c9' 
  AND (
    token = 'TwTpp25rklST/xveORXnSJpic0/Xtcty68ABJZuaIfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046