UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qGQBR4t2XMrjK1C73of/l8yoESoB3nXC9gtHVF6YhQU=' 
WHERE 
  key_id = 'dd3e5931957512d18a3b225cb4296e092a73e01d90ca9a5bf2807186ec137e66' 
  AND (
    token = 'qGQBR4t2XMrjK1C73of/l8yoESoB3nXC9gtHVF6YhQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035